﻿using FluentValidation;
using Mes.Application.DTO.Inputs.Operations;

namespace Mes.Application.Web.Validators.Operations.Attr
{
    public class AttrInputValidator : AbstractValidator<AttrInput>
    {
        public AttrInputValidator()
        {
            RuleFor(x => x.Data_Type)
                .GreaterThanOrEqualTo(0)
                .LessThanOrEqualTo(6)
                .NotEqual(4);

            RuleFor(x => x.Attr_Desc)
                .NotEmpty().WithMessage("Attr_Desc不能为空")
                .MinimumLength(1).WithMessage("Attr_Desc长度不能小于1")
                .MaximumLength(255).WithMessage("Attr_Desc长度不能大于255")
                .Length(1, 255);
        }
    }
}
